class FranjasController < ApplicationController
#MODULE: Configuraciones

  # GET /franjas
  # GET /franjas.xml
  def index
            @franjas = Franja.all
    
    
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @franjas }
    end
      end

  # GET /franjas/1
  # GET /franjas/1.xml
  def show
    @franja = Franja.find(params[:id])
    
    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @franja }
    end
  end

  # GET /franjas/new
  # GET /franjas/new.xml
  def new
        @franja = Franja.new
    
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @franja }
    end
  end

  # GET /franjas/1/edit
  def edit
    @franja = Franja.find(params[:id])
  end

  # POST /franjas
  # POST /franjas.xml
  def create
        @franja = Franja.new(params[:franja])
    
    respond_to do |format|
      if @franja.save
        flash[:notice] =  'Franja creada correctamente.'
                format.html { params[:oper].nil? ? redirect_to(@franja) : render(:text => "Ok")}
              else
        format.html { render :action => "new" }
        format.xml  { render :xml => @franja.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /franjas/1
  # PUT /franjas/1.xml
  def update
    @franja = Franja.find(params[:id])

    respond_to do |format|
      if @franja.update_attributes(params[:franja])
        flash[:notice] = 'Franja actualizado correctamente.'
                format.html { redirect_to(@franja) }
                format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @franja.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /franjas/1
  # DELETE /franjas/1.xml
  def destroy
    @franja = Franja.find(params[:id])
    @franja.destroy

    respond_to do |format|
            format.html { redirect_to(franjas_url) }
            format.xml  { head :ok }
    end
  end
   
end
